package com.example.administrator.yuejian_15.activity;

import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


import com.example.administrator.yuejian_15.R;
import com.example.administrator.yuejian_15.adapter.JlbJlAdapter;
import com.example.administrator.yuejian_15.bean.JlbJlBean;
import com.example.administrator.yuejian_15.listener.ListListener;
import com.example.administrator.yuejian_15.model.JlbJlModel;

import java.util.List;

public class JlbJlActivity extends BaseActivity implements View.OnClickListener {
    TextView jl_jlbjl;
    ImageView jl_fh;
    RecyclerView rv_jllist;
    String jlbid;
    List<JlbJlBean> items;

    @Override
    void initView() {

        setLayout_file(R.layout.activity_jlb_jl);
        jl_jlbjl=(TextView)findViewById(R.id.jl_jlbjl);
        jl_fh=(ImageView)findViewById(R.id.jl_fh);
        rv_jllist=(RecyclerView)findViewById(R.id.rv_jllist);

        jlbid=getIntent().getStringExtra("jlbid");
        JlbJlModel jlbJlModel = new JlbJlModel();
        jlbJlModel.getJlList(jlbid,jlbJlBeanListListener);
    }

    @Override
    void initEvent() {
        jl_fh.setOnClickListener(this);

    }

    @Override
    void initDate() {

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.jl_fh:
                finish();
                break;
        }
    }


    ListListener<JlbJlBean> jlbJlBeanListListener = new ListListener<JlbJlBean>() {
        @Override
        public void onResponse(List<JlbJlBean> list) {
            LinearLayoutManager linearLayoutManager=new LinearLayoutManager(JlbJlActivity.this);
            linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
            rv_jllist.setLayoutManager(linearLayoutManager);
            items=list;
            JlbJlAdapter jlbJlAdapter=new JlbJlAdapter(JlbJlActivity.this,items,R.layout.item);
            rv_jllist.setAdapter(jlbJlAdapter);
            rv_jllist.setItemAnimator(new DefaultItemAnimator());


        }

        @Override
        public void onFail(String msg) {

        }
    };
}
//10 19  